<template>
    <view class="identityPage">

        <image class="topBg top-15 bottom-20" src="https://image.srea.org.cn/xcx/purchase-identity-top-bg.png" mode="widthFix"></image>

        <text class="title top-20">您属于以下哪种情况</text>
        <view class="identityList top-15">
            <block v-for="item in list" :key="item.type">
                <view class="itemBox flex" @click="toCensus(item)">
                    <view class="item flex">
                        <text></text>
                        <text class="itemTit flex">{{item.title}}</text>
                        <up-icon name="arrow-down" color="#007235" size="16"></up-icon>
                    </view>
                </view>
            </block>
        </view>

        <!-- <share-btn :display="scrollAnimate"></share-btn> -->
    </view>
</template>

<script>
    // import { dispatchClient } from '@/common/api-adviser';
    import { isBoolean } from '@/common/common';
	export default {
        data() {
            return {
				list: [
					{
						title: "单身人士",
						type: "single"
					},
					{
						title: "已婚人士",
						type: "married"
					},
					{
						title: "本市集体\n户口",
						type: "collective"
					},
					{
						title: "在读博士\n博士后",
						type: "doctor"
					},
					{
						title: "部队人员",
						type: "troop"
					},
					{
						title: "外国籍或者港澳台同胞",
						type: "abroad"
					},
                    // {
					// 	title: "人才住房",
					// 	type: "renCai"
					// },
                    {
						title: "多子女家庭",
						type: "duoHai"
					}
				],
                duoHaiImg: 'https://image.srea.org.cn/xcx/xian-gou-duo-zi-nv.jpg',
                showModel: false,
                scrollAnimate: false,
                pid: '',
                title: '',
                share: false,
                start_time: 0,
            }
        },
        onLoad(options){
            const that = this;
            let {productId='', title='', share=false, puid='' } = options;
            this.pid = productId&&productId!=='undefined'?productId:'';
            this.title = title&&title!=='undefined'?title:'';
            this.share = isBoolean(share);
            this.start_time = (new Date()).getTime();
            uni.$check_and_login(function () {
                //绑定客户
                // dispatchClient({
                //     share: that.share,
                //     puid: puid,
                //     pid: that.pid
                // });
            })
        },

        onPageScroll() {
            const that = this;
            that.scrollAnimate = true;
            this.$u.debounce(function() {
                that.scrollAnimate = false;
            }, 500);
        },
		
		//分享
		onShareAppMessage(res) {
			return {
				title: "上海限购查询，快来测测限购几套",
				path: `/pages/tools/purchase/identity?productId=${this.pid}&title=${this.title}&share=true&prepage=上海限购查询-${this.pid}-${this.title}`,
			}
		},
        
        onShareTimeline() {
            return {
                title: "上海限购查询，快来测测限购几套",
                query: `productId=${this.pid}&title=${this.title}&share=true&prepage=上海限购查询-${this.pid}-${this.title}`
            }
        },
		
		methods:{
			toCensus(info){
                switch(info.type) {
                    case 'duoHai':
                        uni.navigateTo({
                            url: `/pages/tools/purchase/duo-hai-hu-ji-select`
                        })
                        break;
                    default:
                        uni.navigateTo({
                            url: `/pages/tools/purchase/census?type=${info.type}`
                        })
                }
			}
		}
    }
</script>

<style scoped lang="scss">
	.identityPage{
        .topBg{
            width: 100%;
        }
		.title{
			font-size: 40rpx;
			text-align: center;
			display: block;
		}
		.identityList{
            display: grid;
            grid-template-columns: repeat(3, 33.33333%);
            grid-template-rows: repeat(3, 234rpx);
			.itemBox{
				.item{
					width: 200rpx;
					height: 200rpx;
					text-align: center;
					justify-content: space-between;
					border-radius: 50%;
					border: 1rpx solid $theme-color;
					flex-direction: column;
					font-size: 28rpx;
					line-height: 1.3;
					.itemTit{
						margin-top: 35rpx;
					}
				}
			}
		}
	}

</style>
